<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
$tabs=array(
	array('op'=>'basic','title'=>'基本参数设置'),
	array('op'=>'message_tpl','title'=>'模版消息设置'),
	array('op'=>'sms_tpl','title'=>'短信模版设置'),
	array('op'=>'diy','title'=>'自定义菜单'),
);
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$footernav = array(
			array('title'=>'首页','icon'=>'icon-shouye','color'=>'#cc99ff','action'=>'jy_meiye/index/','image'=>'../addons/jy_weishop/resource/images/jy_weishoparticle.png'),
			array('title'=>'项目','icon'=>'icon-quanbudingdan','color'=>'#66cc99','action'=>'jy_meiye/sever/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
			array('title'=>'技师','icon'=>'icon-service','color'=>'#ff9933','action'=>'jy_meiye/worker/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
			array('title'=>'我的','icon'=>'icon-wo1','color'=>'#66cc66','action'=>'jy_meiye/home/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
	);
	$return['item']=$this->plugin_setting('basic');
	$return['item']['footernav']=$return['item']['footernav']?:$footernav;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
		    array('type'=>'string','title'=>'门店名称','name'=>'name','help'=>''),
			array('type'=>'image','title'=>'门店LOGO','name'=>'logo','help'=>''),
			array('type'=>'string','title'=>'公告','name'=>'notice'),
			array('type'=>'time_hour','title'=>'营业时间','name'=>'work_time'),
			array('type'=>'string','title'=>'门店电话','name'=>'phone'),
			array('type'=>'string','title'=>'门店地址','name'=>'address'),
			array('type'=>'text','title'=>'门店详情','name'=>'remark'),
			array(
					'type'=>'array',
					'name'=>'image',
					'add_tip'=>'添加一个幻灯片',
						'list'=>array(
							array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片'),
							array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
							
						),
						'details'=>array(
							array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片','help'=>''),
							array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
							
						)
			),
			array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
		),
		),
	);
	$return['htmls']=$htmls;
	set_html('framess',$this->menu());
	exi($return);
}
if($_RQ['op']=='message_tpl'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('confirm','cancel','tuikuan','disagree'),$postdata);
		$this->plugin_setting('message_tpl',$data);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('message_tpl');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
			array('type'=>'string','title'=>'预约已确认通知消息模版','name'=>'confirm','help'=>'请在微信公众平台搜索‘’模板，找到编号为‘’的模板，添加到你的模板库中，然后将对应的模板id复制到此项中'),
			array('type'=>'string','title'=>'预约被取消通知消息模版','name'=>'cancel'),
			array('type'=>'string','title'=>'退款成功通知消息模版','name'=>'tuikuan'),
			array('type'=>'string','title'=>'退款被拒绝通知消息模版','name'=>'disagree'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='sms_tpl'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('notice'),$postdata);
		$this->plugin_setting('sms_tpl',$data);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('sms_tpl');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
			array('type'=>'string','title'=>'新订单通知模版','name'=>'notice'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='diy'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('store','serve','worker','home'),$postdata);
		$this->plugin_setting('diy',$data);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('diy');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
			array('type'=>'string','title'=>'首页','name'=>'store','help'=>'填写则底部菜单"首页"将替换为填写的内容，不填则为默认的菜单'),
			array('type'=>'string','title'=>'项目','name'=>'serve','help'=>'填写则底部菜单"项目"将替换为填写的内容，不填则为默认的菜单'),
			array('type'=>'string','title'=>'技师','name'=>'worker','help'=>'填写则菜单"技师"将替换为填写的内容，不填则为默认的菜单'),
			array('type'=>'string','title'=>'我的','name'=>'home','help'=>'填写则菜单"我的"将替换为填写的内容，不填则为默认的菜单'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}

